﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using YouYi.YingShengBack.IRepository;
using YouYi.YingShengBack.IService;

namespace YouYi.YingShengBack.Service
{
   /* public class BaseService<T> : IBaseService<T> where T : class, new()
    {
        private IBaseRepository<T, WaiXiuEntities> _baseRepository;
        public BaseService(IBaseRepository<T, WaiXiuEntities> baseRepository)
        {
            _baseRepository = baseRepository;
        }
        /// <summary>
        /// 通用单表添加
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public bool Add(T entity)
        {
            return _baseRepository.Add(entity);
        }
        /// <summary>
        /// 通用单表修改
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public bool Update(T entity)
        {
            return _baseRepository.Update(entity);
        }
        /// <summary>
        /// 通用单表删除
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public bool DelToClass(T entity)
        {
            return _baseRepository.DelToClass(entity);
        }

        /// <summary>
        /// 通用单表批量删除
        /// </summary>
        /// <param name="entitys"></param>
        /// <returns></returns>
        public bool DelToList(List<T> entitys)
        {
            return _baseRepository.DelToList(entitys);
        }

        /// <summary>
        /// 通用id 批量删除
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        public bool DelToArray(params int[] ids)
        {
            return _baseRepository.DelToArray(ids);
        }
        /// <summary>
        /// 返回一个表数据集合
        /// </summary>
        /// <param name="expression"></param>
        /// <returns></returns>
        public List<T> SetList(Expression<Func<T, bool>> expression)
        {
            return _baseRepository.SetList(expression);
        }
        /// <summary>
        /// 返回一个记录
        /// </summary>
        /// <param name="expression"></param>
        /// <returns></returns>
        public T Set(Expression<Func<T, bool>> expression)
        {
            return _baseRepository.Set(expression);
        }
        /// <summary>
        /// 判断记录是否存在
        /// </summary>
        /// <param name="expression"></param>
        /// <returns></returns>
        public bool Exist(Expression<Func<T, bool>> expression)
        {
            return _baseRepository.Exist(expression);
        }
        /// <summary>
        /// 分页
        /// </summary>
        /// <param name="page"></param>
        /// <param name="limit"></param>
        /// <param name="where"></param>
        /// <param name="orderBy"></param>
        /// <param name="count"></param>
        /// <param name="isAsc"></param>
        /// <returns></returns>
        public List<T> SetPageList<TY>(int page, int limit, Expression<Func<T, bool>> where, Expression<Func<T, TY>> orderBy, out int count, bool isAsc = true)
        {
            return _baseRepository.SetPageList(page, limit, where, orderBy, out count, isAsc);
        }
        /// <summary>
        /// 返回总数
        /// </summary>
        /// <param name="where"></param>
        /// <returns></returns>
        public int Count(Expression<Func<T, bool>> where)
        {
            return _baseRepository.Count(where);
        }
    }*/
}
